<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>常见CSS操作（2）</title>
    <script type="text/javascript"src="../js/jquery-3.3.1.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("button").click(function () {
                //将当前button 元素的父元素（<div>）的背景颜色设置为red
                $(this).offsetParent().css("background","red");
            })
        })

    </script>
</head>
<body>
      <div style="border: 5px solid #000; width:100px;height: 100px;
                position: absolute;left: 10px;top: 200px">
          <button>父元素背景</button>

      </div>
</body>
</html>